#include <stdio.h>
int main()
{
	int k=8;
	int arr[]={1,2,3,4,5,6,7,8,9,10};
	int left=0;
	int right=sizeof(arr)/sizeof(arr[0])-1;
	int mid=0;
	while(left<=right)
	{
		mid=(left+right)/2;
		if(arr[mid]<k)
		{
			left=mid+1;
		}
		else if(arr[mid]>k)
		{
			right=mid-1;
		}
		else
		{
			printf("这个arr[]的下标是%d\n",mid);
			printf("要找的数是%d\n",arr[mid]);
			printf("%d",k);
			break;
		}
    }
    if(left>right)
    {
   	    printf("要找的数不在arr[]里面");
	}
	return 0;
}